package com.xuya.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.xuya.entity.Adminer;
import com.xuya.util.DBHelp;
import com.xuya.util.RowMapper;

public class AdminerDao {
	DBHelp<Adminer> db = new DBHelp<Adminer>();
	public Adminer findByName(String name){
		String sql = "select username,password ,id from t_adminer where username = ?";
		return db.executeForObject(sql, new AdminerRowMapper(), name);
	}
	public class AdminerRowMapper implements RowMapper<Adminer>{

		public Adminer mapperRow(ResultSet res) throws SQLException {
			Adminer adminer = new Adminer();
			adminer.setId(res.getInt("id"));
			adminer.setName(res.getString("username"));
			adminer.setPwd(res.getString("password"));
			return adminer;
		}
		
		
	};
	
}
